import requests

# 添加员工
# url = "http://ihrm-test.itheima.net/api/sys/user"
# header = {"Content-Type":"application/json","Authorization":"Bearer 8381a67d-21fb-412a-af6f-da7c8a7f5a61"}
# json_data = {
#             "username": "xiao猪琪",
#             "mobile": "13453226796",
#             "workNumber": "9988"
# }
# resp = requests.post(url=url,headers=header,json=json_data)
# print("添加员工",resp.json())
# 查询员工
url_query = "http://ihrm-java.itheima.net/api/sys/user/1536344880048046080"
header_query = {"Content-Type": "application/json", "Authorization": "Bearer 02559532-0aa2-4de9-92b6-984e552b51d6"}
resp_query = requests.get(url=url_query, headers=header_query)
print("查询员工", resp_query.json())
# 修改员工
url_modify = "http://ihrm-java.itheima.net/api/sys/user/1536344880048046080"
header_modify = {"Content-Type": "application/json", "Authorization": "Bearer 02559532-0aa2-4de9-92b6-984e552b51d6"}
modify_data = {"username":"八戒大大"}
resp_modify = requests.put(url=url_modify, headers=header_modify,json=modify_data)
print("修改员工",resp_modify.json())
# 删除员工
url_del = "http://ihrm-java.itheima.net/api/sys/user/1536344880048046080"
header_del = {"Content-Type": "application/json", "Authorization": "Bearer 02559532-0aa2-4de9-92b6-984e552b51d6"}
resp_del = requests.delete(url=url_del, headers=header_del)
print("删除员工", resp_del.json())